<?php

class Application_Model_DbTable_Zzzusezaj extends Zend_Db_Table_Abstract {

    protected $_name = 'zzzusezaj';
    protected $_referenceMap = array(
        'User' => array(
            'columns' => array('USE_id'),
            'refTableClass' => 'Application_Model_DbTable_User',
            'refColumns' => array('USE_id')
        ),
        'Zajecia' => array(
            'columns' => array('ZAJ_id'),
            'refTableClass' => 'Application_Model_DbTable_Zajecia',
            'refColumns' => array('ZAJ_id')
        )
    );

    //za parametry przyjmuje PK z tabel user, zajecia /tabela łącząca n:m
    public function jointUserZajecia($USE_id, $ZAJ_id) {
        $data = array(
            'USE_id' => $USE_id,
            'ZAJ_id' => $ZAJ_id
        );
        $this->insert($data);
    }

    public function deleteIntersection($USE_id, $ZAJ_id) {
        $this->delete("ZAJ_id = '$ZAJ_id' AND USE_id = '$USE_id'");
    }

}

